using System;
using L=Science.Physics.GeneralPhysics;

namespace Serway.Chapter07
{
	/// <summary>
	/// Example07: A Block Pulled Frictionless Surface
	/// A 6.0 kg block initially at rest is pulled to the right 
	/// along a horizontal, frictionless surface by a constant 
	/// horizontal force of 12 N. Find the speed of the block 
	/// after it has moved 3.0 m.
	/// v_f = 3.5 m/s
	/// </summary>
	public class Example07
	{
		public Example07()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
			L.Mass m = new L.Mass();
			m.kg = 6.0;
			L.Displacement x = new L.Displacement();
			x.X = 3.0;
			L.Force f = new L.Force();
			f.X = 12.0;
			L.Work w = new L.Work(f,x);
		    L.KineticEnergy initial = new L.KineticEnergy();
			initial.J = 0.0;  // initially at rest
			L.KineticEnergy final = new L.KineticEnergy();
			final.VariableQ = true;  // true for only one variable

			L.FundamentalLaw.WorkEnergyTheorem(initial,w,final);
			
			L.Velocity v_f = new L.Velocity(m,final);
			result += Convert.ToString(v_f.mPERs);
		}
	}
}
